package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.Fuel;



public class FuelDao extends IbatisDao{
	
	public List selectFuel() throws SQLException {
		List selectFuel = null;
			selectFuel =getSqlMap().queryForList("SELECT_ALL_FUEL", null);
		return selectFuel;
	}

	public int deleteFuel(Fuel fuel) throws SQLException{
		return (int) getSqlMap().delete("DELETE_FUEL", fuel);
	}
	
	public int updateFuel(Fuel fuel) throws SQLException{
		return (int) getSqlMap().update("UPDATE_FUEL", fuel);
	}
	
	public Fuel insertFuel(Fuel fuel) throws SQLException{
		return (Fuel) getSqlMap().insert("INSERT_FUEL", fuel);
	}

	/*public Vendor insertVendorType(Vendor vendor) throws SQLException {
		return (Vendor) getSqlMap().insert("INSERT_VENDOR_TYPE",vendor);
	}
	
		public List selectVendorType() throws SQLException {
		return getSqlMap().queryForList("SELECT_ALL_VENDOR_TYPE", null);
	}*/
	
		
	public static void main (String args[]) throws SQLException{
		Fuel fuel = new Fuel();
		fuel.setConsumed(3f);
		new FuelDao().insertFuel(fuel);
		System.out.println("Fuel dengan objek id "+ fuel.getConsumed() + " telah di insert pada DB");
		
		/*fuel = new FuelDao().selectFuel(21000);
		System.out.println("Fuel dengan objek id "+fuel.getObjectId() + " telah di dapat dari DB" +
				"dengan id = " + fuel.getFuelId());*/
		
		/*fuel.setObjectId(321);
		new FuelDao().updateFuel(fuel);
		System.out.println("Fuel dengan objek id "+fuel.getObjectId() + " telah di update pada DB");*/
		
		
		}
}